package cn.yuanqiao.cqbc.yqSetPlate.service.impl;

import cn.yuanqiao.common.utils.SecurityUtils;
import cn.yuanqiao.cqbc.yqSetPlate.domain.YqSetPlate;
import cn.yuanqiao.cqbc.yqSetPlate.mapper.YqSetPlateMapper;
import cn.yuanqiao.cqbc.yqSetPlate.service.YqSetPlateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 组盘表 服务实现类
 * </p>
 *
 * @author lyk
 * @since 2022-11-22
 */
@Service
public class YqSetPlateServiceImpl implements YqSetPlateService {

    @Autowired
    private YqSetPlateMapper yqSetPlateMapper;

    @Override
    public int add(YqSetPlate param){
        String tenantCode = SecurityUtils.getTenantCode();
        param.setTenantCode(tenantCode);
        return yqSetPlateMapper.add(param);
        //YqSetPlate entity = getEntity(param);
        //this.save(entity);
    }

    @Override
    public int delete(Long id){
        return yqSetPlateMapper.delete(id);
        //this.removeById(getKey(param));
    }

    @Override
    public int update(YqSetPlate param){
        return yqSetPlateMapper.update(param);
        //YqSetPlate oldEntity = getOldEntity(param);
        //YqSetPlate newEntity = getEntity(param);
        //ToolUtil.copyProperties(newEntity, oldEntity);
        //this.updateById(newEntity);
    }

    @Override
    public YqSetPlate findBySpec(YqSetPlate param){
        return null;
    }

    @Override
    public YqSetPlate getById(Long id) {
        return yqSetPlateMapper.getById(id);
    }

    @Override
    public List<YqSetPlate> findListBySpec(YqSetPlate param){
        String tenantCode = SecurityUtils.getTenantCode();
        param.setTenantCode(tenantCode);
        return yqSetPlateMapper.customList(param);
    }

    /*@Override
    public LayuiPageInfo findPageBySpec(YqSetPlate param){
        Page pageContext = getPageContext();
        IPage page = this.baseMapper.customPageList(pageContext, param);
        return LayuiPageFactory.createPageInfo(page);
    }*/

    /*private Serializable getKey(YqSetPlate param){
        return param.getId();
    }

    private Page getPageContext() {
        return LayuiPageFactory.defaultPage();
    }

    private YqSetPlate getOldEntity(YqSetPlate param) {
        return this.getById(getKey(param));
    }

    private YqSetPlate getEntity(YqSetPlate param) {
        YqSetPlate entity = new YqSetPlate();
        ToolUtil.copyProperties(param, entity);
        return entity;
    }*/

}
